﻿using System.Threading;
using System.Threading.Tasks;
using TiffLibrary;

namespace WholeSlideImageViewer.TiffExport
{
    internal class StreamContentSource : TiffFileContentSource
    {
        private readonly TiffFileContentReaderWriter _readerWriter;

        public StreamContentSource(TiffFileContentReaderWriter readerWriter)
        {
            _readerWriter = readerWriter;
        }

        public override TiffFileContentReader OpenReader()
        {
            return _readerWriter;
        }

        public override ValueTask<TiffFileContentReader> OpenReaderAsync(CancellationToken cancellationToken = default)
        {
            return new ValueTask<TiffFileContentReader>(_readerWriter);
        }

        protected override void Dispose(bool disposing) { }

        public override ValueTask DisposeAsync() { return default; }
    }
}
